package cn.wanho.rvo;

public class ResultVO {
    /** 返回码  成功1xxxx 失败2xxxx */
    private String resCode;
    /** 每次返回后得到的信息是什么 */
    private String resMsg;
    /** 如果成功返回的数据是什么 */
    private Object data;

    //构造方法生成对象
    public ResultVO(String resCode, String resMsg){
            this.resCode = resCode;
            this.resMsg = resMsg;
    }
    public ResultVO(String resCode, String resMsg, Object data){
        this.resCode = resCode;
        this.resMsg = resMsg;
        this.data = data;
    }

    /**
     * 成功情况1 只返回rescode resmsg
     * @return
     */
    public static ResultVO success(String resCode,String resMsg){
            return new ResultVO(resCode,resMsg);
    }
    /**
     * 成功情况2 只返回rescode resmsg data
     * @return
     */
    public static ResultVO success(String resCode,String resMsg,Object data){
        return new ResultVO(resCode,resMsg,data);
    }
    /**
     * 失败情况 只返回rescode resmsg
     * @return
     */
    public static ResultVO failure(String resCode,String resMsg){
        return new ResultVO(resCode,resMsg);
    }

    public static  ResultVO failure(String resCode,String resMsg,Object data){
        return new ResultVO(resCode,resMsg,data);
    }

    public String getResCode() {
        return resCode;
    }

    public void setResCode(String resCode) {
        this.resCode = resCode;
    }

    public String getResMsg() {
        return resMsg;
    }

    public void setResMsg(String resMsg) {
        this.resMsg = resMsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


}
